< previous page page_12 next page >

Page 12
A Primer on Classes
A class is an abstract entity that carries out a subset of your user's requirements. Each abstraction has behavior, which is a set of functions or methods, and attributes, which are variables or properties that identify the class. Let's look at abstract entity, behavior, and attributes more closely.
New Term: A class is an abstract entity, a thing, that carries out a subset of your user's requirements. It represents a classification of key abstractions you discover while assessing a given problem.
Abstract Entity
You might say that a class is a template. Some people call classes cookie cutters because each use of the cutter results in an edible cookie. Each cookie you eat is an instance of the cookie class. An instantiated object is brought into your computer's memory. It is a concrete objectan object with which you can interact in your application. Although this is true of concrete classes, this is not completely true of every class. However, for starters, this might help you grasp the concept of a class.
New Term: A concrete class is a child of a parent class whose instances provide runtime behavior for an application system. A concrete class is similar to a cookie cutter and the cookie it creates. An abstract class, by contrast, is the mold used to create the cookie cutter.
A class is much more than a mere cookie cutter or template. It is more than just a convenient way to organize code. Understanding the very nature of a class is difficult for many programmers new to OOP, as I discovered after several interviews with programmer candidates. As mentioned earlier, a class is an abstract entity.
Another more general term for abstract entity is abstraction. In his classic book Object-Oriented Analysis and Design with Applications, Second Edition, Grady Booch defines an abstraction as one of the fundamental ways that we as humans cope with complexity. Notice that Booch did not use programming jargon or technical idioms in describing abstraction. His definition strikes a more human tone, potentially leaving you with the idea that the programming world is starting to learn from other human experiences.
Now for a more technical definition. Booch further defines an abstraction as denoting the essential characteristics of an object that distinguish it from all other kinds of objects and thus provides crisply defined conceptual boundaries, relative to the perspective of the viewer. When you're starting to discover a solution to a common problem, thenno matter what scaleyou have to look for descriptions of concepts and ideas in the problem that are important to the person who will use the solution you develop. In

 
< previous page page_12 next page >

If you like this book, buy it!